package Dispatcher;

import java.io.PrintWriter;

/**
 * Receives the destination from dispatcher and prints it out
 * 
 * @author Varun Maryada, Sanat Dixit, Steve Tannahill
 * 
 */
public class SendElevatorRequestThread extends Thread {

	private static final int ELEVATORCALL = 6;
	
	private int dest;
	private PrintWriter ec;

	public SendElevatorRequestThread(int destination, PrintWriter ec) {
		this.ec = ec;
		this.dest = destination;
	}

	@Override
	public void run() {
		System.out.println("Elevator Request for Floor " + this.dest);
		if (this.ec == null) System.out.println("TCP NOT WORKING");
		if (this.ec != null) {
			this.ec.println(ELEVATORCALL + "/" + dest + "/" + "\n");
		}
	}
}
